package com.c6906.vdam.das.model.entity;

import cn.hutool.core.date.DateUtil;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 擅自改变出行线路预警
 */
@Data
public class EWVehiclesUnauthTask {
    private String useCode;
    private Long taskId;
    private String terminalSn;
    private String startAddr;
    private BigDecimal startAddrLon;
    private BigDecimal startAddrLat;
    private String targetEndAddr;
    private BigDecimal targetEndLon;
    private BigDecimal targetEndLat;
    private String realStartAddr;
    private BigDecimal realStartLon;
    private BigDecimal realStartLat;
    private String realEndAddr;
    private BigDecimal realEndLon;
    private BigDecimal realEndLat;
    private Date realStartTime;
    private Date realEndTime;
    private BigDecimal evalMiles;
    private BigDecimal odometerMiles;
    private Integer warningLevel;
    private String usePersonId;
    private String usePersonName;
    private String eventDate;

    // 到达地不符-黄色预警
    public EWVehiclesUnauthTask(TerminalBusinessInfo terminalBusinessInfo, VehiclesTask vehiclesTask) {
        this.useCode = vehiclesTask.getUseCode();
        this.taskId = vehiclesTask.getId();
        this.terminalSn = terminalBusinessInfo.getTerminalSn();
        this.warningLevel = 4;
        this.startAddr = vehiclesTask.getStartAddr();
        this.startAddrLon = vehiclesTask.getStartAddrLon();
        this.startAddrLat = vehiclesTask.getStartAddrLat();
        this.targetEndAddr = vehiclesTask.getTargetAddr();
        this.targetEndLon = vehiclesTask.getTargetAddrLon();
        this.targetEndLat = vehiclesTask.getTargetAddrLat();
        this.realStartAddr = vehiclesTask.getRealStartAddr();
        this.realStartLon = vehiclesTask.getRealStartAddrLon();
        this.realStartLat = vehiclesTask.getRealStartAddrLat();
        this.realEndAddr = vehiclesTask.getRealEndAddr();
        this.realEndLon = vehiclesTask.getRealEndAddrLon();
        this.realEndLat = vehiclesTask.getRealEndAddrLat();
        this.realStartTime = vehiclesTask.getRealStartTime();
        this.realEndTime = vehiclesTask.getRealEndTime();
        this.evalMiles = vehiclesTask.getEvalMiles();
        this.odometerMiles = vehiclesTask.getOdometerMiles();
        this.usePersonId = vehiclesTask.getUsePersonId();
        this.usePersonName = vehiclesTask.getUsePersonName();
        this.eventDate = DateUtil.formatDate(vehiclesTask.getRealStartTime()) + " 至 " + DateUtil.formatDate(vehiclesTask.getRealEndTime());
    }
}
